/**
 * Created by bootdo.
 */
import Env from './env';
import axios from 'axios'


axios.defaults.withCredentials = false;


//测试使用
export const ISDEV = Env.isDev;

//通用方法
export const POST = (url, params) => {
  return axios.post(`${url}`, params).then(res => res.data)
};

export const GET = (url, params) => {
  return axios.get(`${url}`, {
    params: params
  }).then(res => res.data)
};
export const POSTBLOB = (url, params) => {
  return axios({
    method:'post',
    url:`${url}`,
    data:params,
    responseType:'blob'
  }).then(res => res.data)
};
export const GETBLOB = (url, params) => {
  return axios.get(`${url}`, {
    params: params,
    responseType:'blob'
  }).then(res => res.data)
};
export const GETBLOBAll = (url, params) => {
  return axios.get(`${url}`, {
    params: params,
    responseType:'blob'
  }).then(res => res)
};
export const POSTBLOBAll = (url, params) => {
  return axios({
    method:'post',
    url:`${url}`,
    data:params,
    responseType:'blob'
  }).then(res => res)
};
export const GET2 = (url, params) => {
  return axios.get(`${url}`, {
    params: params
  }).then(res => res.data)
};

export const PUT = (url, params) => {
  return axios.put(`${url}`, params).then(res => res.data)
};

export const DELETE = (url, params) => {
  return axios.delete(`${url}`, {
    params: params
  }).then(res => res.data)
};

export const PATCH = (url, params) => {
  return axios.patch(`${url}`, params).then(res => res.data)
};
